package com.videostreaming.utils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author sad
 */
public class Utils {

    public static List makeTableFromList(List list, int columnCount) {
        List result = new ArrayList();
        int index = 0;
        boolean stop = false;
        while (!stop) {
            List row = new ArrayList();
            for (int i = 0; i < columnCount; i++, index++) {
                if (index>=list.size()) {
                    stop = true;
                    break;
                }

                row.add(list.get(index));
            }

            result.add(row);
        }

        return result;
    }
}
